<?php

function seitcm_menu() {
	if(current_user_can('seitcm_seitcmboard_view'))
	{
		add_menu_page(__('SEIT Class Managerment','SEITCM'), 'SEITCM Board', 'seitcm_seitcmboard_view', 'seitcm_main_option_menu', 'seitcm_main_option_menu',null,3 );
		if( current_user_can('seitcm_employer_list')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM Employers Management','SEITCM'), __('Emploers','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_employers_option_menu', 'seitcm_employers_option_menu');
		}
		if( current_user_can('seitcm_courses_list')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM Courses Management','SEITCM'), __('Courses','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_courses_option_menu', 'seitcm_courses_option_menu');
		}
		if( current_user_can('seitcm_class_list') || current_user_can('seitcm_class_responsible_list')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM Classes Management','SEITCM'), __('Classes','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_class_option_menu', 'seitcm_class_option_menu' );
		}
		if( current_user_can('seitcm_student_list')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM Students Management','SEITCM'), __('Students','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_students_option_menu', 'seitcm_students_option_menu');
		}
		if( current_user_can('seitcm_statitic')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM Students Management','SEITCM'), __('Students','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_students_option_menu', 'seitcm_students_option_menu');
		}
		if( current_user_can('seitcm_scores_statistics')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM score statistics','SEITCM'), __('Score statistics','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_scores_statistics', 'seitcm_scores_statistics' );
		}
		if( current_user_can('seitcm_registration_statistics')) {
			add_submenu_page('seitcm_main_option_menu',__('SEITCM register statistics','SEITCM'), __('Register statistics','SEITCM'), 'seitcm_seitcmboard_view', 'seitcm_registration_statistics', 'seitcm_registration_statistics' );
		}
	}
}

function seitcm_main_option_menu() {
	if ( !current_user_can( 'seitcm_seitcmboard_view') )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else {
		require_once 'seitcm_main_option.php';
	}
}

function seitcm_employers_option_menu() {
	if ( !(current_user_can( 'seitcm_employer_list' )) )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else require_once 'seitcm_employers_option.php';
}
function seitcm_students_option_menu() {
	if ( !(current_user_can( 'seitcm_student_list' )) )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else require_once 'seitcm_students_option.php';
}
function seitcm_courses_option_menu() {
	if ( !(current_user_can( 'seitcm_courses_list' )) )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else require_once 'seitcm_courses_option.php';
}
function seitcm_class_option_menu() {
	if ( !(current_user_can('seitcm_class_list') || current_user_can('seitcm_class_responsible_list')) )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else require_once 'seitcm_class_option.php';
}
function seitcm_registration_statistics() {
	if ( !current_user_can('seitcm_registration_statistics') )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else require_once 'seitcm_statistics_register.php';
}
function seitcm_scores_statistics() {
	if ( !current_user_can('seitcm_scores_statistics') )  {
		wp_die( __( 'SEICM: You do not have sufficient permissions to access this page.' ) );
	}
	else require_once 'seitcm_statistics_scores.php';
}

?>